<template>
  <div>
    <!-- 顶部滑动条 -->
    <div id="slider" class="mui-slider">
      <div
        id="sliderSegmentedControl"
        class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted"
      >
        <div class="mui-scroll">
          <a class="mui-control-item mui-active">推荐</a>
          <!-- <a class="['mui-control-item'],item.id==0?'mui-active':''" v-for="item in getAllCategorylist" :key="item.id" :@click="getAllCategorylist(item.id)">
               {{item.title}}
          </a>-->
          <a class="mui-control-item" href="#item2mobile" data-wid="tab-top-subpage-2.html">热点</a>
          <a class="mui-control-item" href="#item3mobile" data-wid="tab-top-subpage-3.html">北京</a>
          <a class="mui-control-item" href="#item4mobile" data-wid="tab-top-subpage-4.html">社会</a>
          <a class="mui-control-item" href="#item5mobile" data-wid="tab-top-subpage-5.html">娱乐</a>
          <a class="mui-control-item" href="#item6mobile" data-wid="tab-top-subpage-6.html">科技</a>
        </div>
      </div>
    </div>

    <!-- <ul class="phone-list">
      <router-link v-for="item in list" :key="item.id" :to="'/home/photoinfo/' + item.id" tag="li">
        <img v-lazy="item.img_url" />
        <div class="info">
          <h1 class="info-title">{{item.title}}</h1>
          <div class="info-body">{{item.zhaiyao}}</div>
        </div>
      </router-link>
    </ul>-->

    <ul class="phone-list">
      <router-link to="/home/photoinfo/" tag="li">
        <img src="../../images/01.png" />
        <div class="info">
          <h1 class="info-title">喜鹊</h1>
          <div class="info-body">哈哈哈哈哈哈</div>
        </div>
      </router-link>
      <router-link to="/home/photoinfo/" tag="li">
        <img src="../../images/02.jpg" />
        <div class="info">
          <h1 class="info-title">都是</h1>
          <div class="info-body">21大萨达所多所</div>
        </div>
      </router-link>
      <router-link to="/home/photoinfo/" tag="li">
        <img src="../../images/03.jpg" />
        <div class="info">
          <h1 class="info-title">但是</h1>
          <div class="info-body">的东西的速度</div>
        </div>
      </router-link>
      <router-link to="/home/photoinfo/" tag="li">
        <img src="../../images/05.jpg" />
        <div class="info">
          <h1 class="info-title">1都知道</h1>
          <div class="info-body">查询出下出现</div>
        </div>
      </router-link>
      <router-link to="/home/photoinfo/" tag="li">
        <img src="../../images/06.jpg" />
        <div class="info">
          <h1 class="info-title">查询</h1>
          <div class="info-body">你们几个</div>
        </div>
      </router-link>
    </ul>
  </div>
</template>
<script>
import mui from '../../lib/mui/js/mui.min.js';
import { Toast } from 'mint-ui';
export default {
  data () {
    return {
      getAllCategorylist: [],
      list: [],

    }

  },
  created () {
    this.getAllCategorylist();
    this.getPhotoList(0);
  },
  mounted () {
    //初始化滑动插件
    mui('.mui-scroll-wrapper').scroll({
      deceleration: 0.0005
    })
  },
  methods: {
    getAllCategory () {
      //获取图片导航栏
      this.$http.get('api/getimgcategory').then(result => {
        if (result.body.status == 0) {
          this.getAllCategorylist = result.body.massage.unshift({ title: "全部", id: 0 });
        } else {
          Toast('获取图片导航栏失败!')
        }
      })
    },
    getPhotoList (cateId) {
      this.$http.get('api/getimages/' + cateId).then(result => {
        if (result.body.status == 0) {
          this.list = result.body.massage;
        } else {
          Toast("图片加载失败!")
        }
      })
    }
  }
}

</script>
 <style lang="scss" scoped>
* {
  touch-action: pan-y;
}

img[lazy="loading"] {
  width: 40px;
  height: 300px;
  margin: auto;
}

img {
  width: 100%;
  vertical-align: middle;
}

.phone-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  padding-bottom: 0;
  li {
    background-color: #ccc;
    text-align: center;
    margin-bottom: 10px;
    box-shadow: 0 0 3px #999;
    position: relative;
  }
}

.info {
  width: 100%;
  color: white;
  text-align: left;
  position: absolute;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.2);
  //   min-height: 84px;
  .info-title {
    font-size: 14px;
  }
  .info-body {
    font-size: 13px;
  }
}
</style>